#include "../test_type.h"
#include "../../src/algorithm/SafeList.h"
#include "../../src/algorithm/SafeMap.h"
#include "../../src/algorithm/SafeSet.h"
#include "../../src/thread/Thread.h"
#include <string>
#include <iostream>

#ifdef TEST_SAFE_DATA
LibTools::CSafeList<int> g_l;
LibTools::CSafeMap<std::string, std::string> g_m;
LibTools::CSafeSet<std::string> g_s;

DWORD ThreadFunc(void* invoker)
{
	int l;
	g_l.Front(l);
	std::cout << l << std::endl;
	std::string value;
	g_m.Erase("1", value);
	std::cout << value << std::endl;
	g_s.Pop(value);
	std::cout << value << std::endl;

	return 0;
}

int main()
{
	LibTools::CThread thr(&ThreadFunc);
	g_l.InsertFront(1);
	g_l.InsertBack(2);
	g_m.Insert("1", "test");
	g_m.Insert("2", "test");
	g_s.Insert("1");
	g_s.Insert("2");

	thr.Join();

	g_s.Clear();
	g_l.Clear();
	g_m.Clear();

	std::cout << g_s.Size() << ", " << g_l.Size() << ", " << g_m.Size() << std::endl;

	return 0;
}
#endif